package com.songcha.module_home.ui.fragment.cate

import android.app.Application
import com.songcha.library_base.interfaces.IApiResult
import com.songcha.library_base.mvvm.base.BaseRefreshLoadMoreViewModel
import com.songcha.library_business.bean.book.BookListBean
import com.songcha.library_business.bean.book.BookNetBean

class HomeCateViewModel(app: Application):BaseRefreshLoadMoreViewModel<HomeCateRepository,BookNetBean>(app) {
    var cateId=0
    //val bookList=MutableLiveData<MutableList<BookNetBean>>()

    fun getHomeCateBookList(){
        if(cateId==0) return
        handleApiDataObserver(repository!!.getHomeCateBookList(cateId,currentPage),object :IApiResult<BookListBean>{
            override fun onSuccess(bean: BookListBean) {
                handleDataListSuccess(bean.data.records)
            }

            override fun onError(e: Throwable) {

            }
        },true)
    }
}